from goods.models import SPUSpecification
from meiduo_admin.mypakge import *

class SpecSerializer(serializers.ModelSerializer):
    """查询获取规格表数据序列化器"""
    # 关联嵌套字段序列化返回
    spu = serializers.StringRelatedField(read_only=True)
    spu_id = serializers.IntegerField()
    class Meta:
        model = SPUSpecification
        fields = [
            'id',
            'name',
            'spu',
            'spu_id'
        ]